//禁止鼠标右键菜单和F12打开控制台看源码
document.oncontextmenu = function () {
    var ii = layer.load();
    //此处用setTimeout演示ajax的回调
    setTimeout(function(){
        layer.close(ii);
        alert('检测发现您的鼠标右键已被系统禁用')
    }, 1000);
    return false;
};
document.onkeydown = function () {
    if (window.event && window.event.keyCode == 123) {
        event.keyCode = 0;
        event.returnValue = false;
        var ii = layer.load();
        //此处用setTimeout演示ajax的回调
        setTimeout(function(){
            layer.close(ii);
            alert('检测发现您的键盘F12键已被系统禁用')
        }, 1000);
        return false;
    }
};